package com.xxx.corejava.day1028;

public class Test4 {

    public static void main(String[] args) {

        double sum=0.0;

        int f=1;

        for (double i = 1; i <= 20; i++) {

            double temp=(i+((2.0*i-1)/(i*i)))*f;
            sum+=temp;//sum=sum+temp;

            f=-f;
        }

        System.out.println("sum = " + sum);
        
    }
}
